//
//  MSUtils.h
//  JinliWallet
//
//  Created by 张玮 on 2018/10/17.
//  Copyright © 2018年 张玮. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NSDictionary+SortWithKey.h"

NS_ASSUME_NONNULL_BEGIN

@interface MSUtils : NSObject

+ (MSUtils *)shareInstance;
- (NSString *)getUUID;
- (void)showMessage:(NSString *)message;
- (void)showMessage:(NSString *)message time:(NSTimeInterval)time;
+(void)callPhone:(NSString *)phone;

@end


static inline NSDictionary *getParams(NSDictionary *param){
    NSMutableDictionary *tmpDic = param ? [param mutableCopy]:[@{} mutableCopy];
    NSString *randomStr = [NSString stringWithFormat:@"%d", arc4random()%999999];
    
    NSNumber *timestamp = [NSNumber numberWithInteger:[[NSDate date] timeIntervalSince1970]*1000];
    
    [tmpDic setObject:randomStr forKey:@"noncestr"];
    [tmpDic setObject:timestamp forKey:@"timestamp"];
    
    
    return tmpDic;
    
}

static inline NSString *getSign(NSDictionary *params){
    return [params stringSortedWithKeyAndHash] == nil ? @"" : [params stringSortedWithKeyAndHash];
}

NS_ASSUME_NONNULL_END
